<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    const target = {
      param: 0,
     
    }
    const handlder = {
      get(target, prop, receiver) {
        if(typeof prop !== 'symbol') {
          target.param += parseInt(prop)
          return new Proxy(target, handlder)
        } else {
          return target[prop]
        }
      }
    }
    const p = new Proxy(target, handlder)
   p[Symbol.toPrimitive] = function() {
    return target.param
   }
    console.log(p[2][3][4])
  </script>
</body>

</html>